// 题目三 练习3
// app.js
const { split } = require('lodash')
const fp = require('lodash/fp')
const { Maybe, Container } = require('./support')

let safeProp = fp.curry(function (x, o){
    return Maybe.of(o[x])
})
let user = { id: 2, name: 'Albert' }

let ex3 = () => {
    const functor = safeProp('name')(user)
                        .map(x => x.split(''))
                        .map(fp.first)
    return functor._value
}
console.log(ex3()) // A
